![]() |
SetResAttrs |
||||
Header: | Resources.h | Carbon status: | Supported | |
Sets a resource’s attributes in the resource map in memory.
void SetResAttrs ( Handle theResource, SInt16 attrs );
A handle to the resource whose attributes you wish to set. If the value of this parameter isn’t a valid handle to a resource, the function does nothing, and the ResError function returns the result code resNotFound.
The resource attributes to set. The resProtected attribute changes immediately. Other attribute changes take effect the next time the specified resource is read into memory but are not made permanent until the Resource Manager updates the resource fork.
Each attribute is identified by a specific bit in the low-order byte of a word. If the bit corresponding to an attribute contains 1, then that attribute is set; if the bit contains 0, then that attribute is not set.
This function changes the information in the resource map in memory, not in the file on disk. If you want the Resource Manager to write the modified resource map to disk after a subsequent call to the UpdateResFile function or when your application terminates, call the ChangedResource function after you call SetResAttrs.
Do not use this function to change a purgeable resource. If you make a purgeable resource nonpurgeable by setting the resPurgeable attribute with this function, the resource doesn’t become nonpurgeable until the next time the specified resource is read into memory. Thus, the resource might be purged while you’re changing it.
You can check for errors using the ResError function. SetResAttrs does not return an error if you are setting the attributes of a resource in a resource file that has a read-only resource map. To find out whether this is the case, use the GetResAttrs function.
Supported in Carbon. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.
© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)